package cn.com.dashihui.api.radisysnc.request;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentHashMap;

import cn.com.dashihui.api.radisysnc.inter.IRequest;
/**
 * ***********************************************
　 * <p>类名: RequestQueue</p> 
　 * <p>描述: 请求队列</p> 
　 * @author niufc 
　 * @date 2019年8月19日 
  * ************************************************
 */
public class RequestQueue {

private List<ArrayBlockingQueue<IRequest>> queues = new ArrayList<>();
    
    private Map<Object, Boolean> flagMap = new ConcurrentHashMap<>();
    private RequestQueue(){
        
    }
    private static class Singleton{
        private static RequestQueue queue;
        static{
            queue = new RequestQueue();
        }
        public static RequestQueue getInstance() {
            return queue;
        }
    }
    
    public static RequestQueue getInstance(){
        return Singleton.getInstance();
    }
    public void addQueue(ArrayBlockingQueue<IRequest> queue) {
        queues.add(queue);
    }
    
    public int getQueueSize(){
        return queues.size();
    }
    public ArrayBlockingQueue<IRequest> getQueueByIndex(int index) {
        return queues.get(index);
    }
    
    public Map<Object,Boolean> getFlagMap() {
        return this.flagMap;
    }


}
